| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /* globals versionCompare, atob, btoa */ |
||
| 31 | function versionControl() { |
||
| 32 | // delete saves older than this version |
||
| 33 | if (state.player.version && versionCompare(state.player.version, '2.1.0') < 0) { |
||
| 34 | state.player = {}; |
||
| 35 | } |
||
| 36 | // we merge the properties of the player with the start player to |
||
| 37 | // avoid undefined errors with new properties |
||
| 38 | state.player = angular.merge({}, data.start_player, state.player); |
||
| 39 | // append an id if it doesn't exist |
||
| 40 | if (!state.player.id) { |
||
| 41 | state.player.id = Math.random().toString().substring(3); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 46 |